import {ColumnDefaultSlotParams} from "vxe-table/types/v-x-e-table";
import {ColumnFormatterMethodParams, ColumnInfo} from "vxe-table/types/column";
import {ColumnEditRenderOptions} from "vxe-table/types/edit";
import {ColumnCellRenderParams} from "vxe-table/types/v-x-e-table/renderer";
import {Table} from "vxe-table";

export interface columnCheckboxSlotParams extends ColumnDefaultSlotParams {
  indeterminate?: boolean;
}

export interface columnRadioSlotParams extends columnCheckboxSlotParams {
  checked?: boolean;
  disabled?: boolean;
}

export interface MyColumnFormatterMethodParams extends ColumnFormatterMethodParams {
  rowIndex: number;
  columnIndex: number;
}

export interface MyColumnInfo extends ColumnInfo {
  prop: string;
  label: string;
}

export interface MyColumnCellRenderParams extends ColumnCellRenderParams {
  column: MyColumnInfo
}


export interface MyColumnEditRenderParams extends MyColumnCellRenderParams {
}

export interface EventsFunctionFirstParam {
  $columnIndex: number;
  $rowIndex: number;
  $table: Table;
  $type: "cell";
  column: ColumnInfo;
  columnIndex: number;
  data: any[]
  fixed: undefined | string | boolean;
  isHidden: undefined | string | boolean;
  items: any[];
  level: number;
  row: object
  rowIndex: number;
  rowid: string;
  seq: number;
  type: "body"
  visibleData: any[]
  _columnIndex: number;
  _rowIndex: number;
}

export type EventsFunction = (firstParam: EventsFunctionFirstParam, ...params) => void

export interface MyColumnRenderOptionsBase extends ColumnEditRenderOptions {
  name?: 'ElInput' | 'ElAutocomplete' | 'ElInputNumber' |
    'ElSelect' | 'ElCascader' | 'ElTimeSelect' | 'ElTimePicker' |
    'ElDatePicker' | 'ElSwitch' | 'ElRate' | 'ElSlider' | 'ElButton' |
    'ElButtons' | 'TreeSelect' | string,

  setOptions?(data: any[] | undefined, params: MyColumnEditRenderParams | MyColumnCellRenderParams): Array<any>;

  asyncSetOptions?(data: any[] | undefined, params: MyColumnEditRenderParams | MyColumnCellRenderParams): Promise<Array<any>>;

  _setOptions: any[];

  /**
   * 目标组件渲染的事件
   */
  events?: { [key: string]: EventsFunction };
  /**
   * 目标组件渲染的原生事件
   */
  nativeEvents?: { [key: string]: EventsFunction };
}


export interface MyColumnEditRenderOptions extends MyColumnRenderOptionsBase {
}

export interface MyColumnCellRenderOptions extends MyColumnRenderOptionsBase {
}
